﻿using System;
using Autodesk.Revit.DB;
using YJKRevitKernel.ElementSearchUtility.LinkDocumentSuite;
using YJKGeometryFuncs.CurveUtility;
using YJKInspectModelFunc.ModelLayer;


namespace YJKSparseDistance.ModelLayer
{
	public class DoorPacker_EvacuationDistance : BaseDoorPacker
	{
		public DoorPacker_EvacuationDistance(FamilyInstance thisDoor, RevitLinkInstance useLinkInstance = null, ElementGeometryPacker tempGeometryPacker = null) : base(thisDoor, useLinkInstance, tempGeometryPacker)
		{
			Wall wall = thisDoor.Host as Wall;
			LocationCurve locationCurve = wall.Location as LocationCurve;
			double width = wall.Width;
			Curve curve = locationCurve.Curve;
			if (base.UseTransform != null)
			{
				curve = curve.CreateTransformed(base.UseTransform);
			}
			Curve curve2 = CurveUtility.CreateOffsetCurve(curve, width / 2.0);
			Curve curve3 = CurveUtility.CreateOffsetCurve(curve, -width / 2.0);
			this.ArrayTwoSideMidPoint[0] = curve2.Project(base.ThisLimitGeometryPacker.CenterPoint).XYZPoint;
			this.ArrayTwoSideMidPoint[1] = curve3.Project(base.ThisLimitGeometryPacker.CenterPoint).XYZPoint;
		}

		public XYZ[] ArrayTwoSideMidPoint
		{
			get
			{
				return this.m_ArrayTwoSideMidPoint;
			}
		}

		private XYZ[] m_ArrayTwoSideMidPoint = new XYZ[2];
	}
}
